//
//  FDPaytypeAlertTool.m
//  FD
//
//  Created by xiaofang wang on 2019/2/13.
//  Copyright © 2019年 ZhiYuan Network. All rights reserved.
//

#import "FDPaytypeAlertTool.h"
#import "XLAlertView.h"

@implementation FDPaytypeAlertTool

#pragma mark - 接口

/**弹框两按钮：线上线下支付弹框*/
+ (void)showAlertTwoPaytypePayOnlineBlock:
(FDPaytypeAlertToolPayOnline)onlinePayBlock
                             offlineBlock:
(FDPaytypeAlertToolPayOffline)offlinePayBlock {
    
    NSString *tsStr = NSLocalizedString(L_Pay_Tips, @"提示");
    NSString *qxzzffsStr = NSLocalizedString(Order_SelectPayType, @"请选择支付方式");
    
    //2019-2-22 同一个中文对应不同的英文所有写了两个词条
    NSString *xxzfStr = NSLocalizedString(L_Pay_Offline_Cash, @"线下支付");
    NSString *zxzfStr = NSLocalizedString(L_Pay_Online, @"在线支付");
    
    XLAlertView *twoAlert = [[XLAlertView alloc] initWithTitle:tsStr message:qxzzffsStr sureBtn:xxzfStr cancleBtn:zxzfStr];
    [twoAlert showXLAlertView];
    twoAlert.resultIndex = ^(NSInteger index) {
        FDLog(@"index:%ld",(long)index);
        if (index == 1) { //在线
            
            if (onlinePayBlock) {
                onlinePayBlock();
            }
        }else if(index == 2){ //线下
            if (offlinePayBlock) {
                offlinePayBlock();
            }
        }
    };
}


/**弹框一个按钮:线上支付*/
+ (void)showAlertOnePayTypeOnlinePayBlock:(FDPaytypeAlertToolPayOnline)onlinePayBlock {

    NSString *tsStr = NSLocalizedString(L_Pay_Tips, @"提示");
    NSString *qxzzffsStr = NSLocalizedString(Order_SelectPayType, @"请选择支付方式");
    NSString *zxzfStr = NSLocalizedString(L_Pay_Online, @"在线支付");
    
    XLAlertView *oneAlert = [[XLAlertView alloc] initWithTitle:tsStr message:qxzzffsStr sureBtn:zxzfStr cancleBtn:nil];
    [oneAlert showXLAlertView];
    oneAlert.resultIndex = ^(NSInteger index) {
        if (onlinePayBlock) {
            onlinePayBlock();
        }
    };
}

@end
